<?php
session_cache_expire(999999999);
if(!isset($_SESSION)) 
{ 
session_start(); 
}  
include '../operations/connection.php';
include '../generallibraries/funcs.php';
$idemployee = $_REQUEST['idemployee'];
$basicsalary = generalFunctions::numberformat_to_basicString($_REQUEST['basicsalary']);
$allowancebasicsalary = generalFunctions::numberformat_to_basicString($_REQUEST['allowancebasicsalary']);
$allowanceC = generalFunctions::numberformat_to_basicString($_REQUEST['allowanceC']);
$allowance_senior = generalFunctions::numberformat_to_basicString($_REQUEST['allowance_senior']);
$insuranceSalary = generalFunctions::numberformat_to_basicString($_REQUEST['insuranceSalary']);
$user_create = $_REQUEST['user_create'];

$user_last_update = $_REQUEST['userlast'];
$page = $_REQUEST['page'];

if (isset($_REQUEST['update'])){
	$update = "UPDATE sa_regulation_salary  SET basic_salary ='$basicsalary',allowance_basic_salary='$allowancebasicsalary',allowance_c='$allowanceC',
		allowance_senior ='$allowance_senior',salary_insurance='$insuranceSalary',user_last_update='$user_last_update',
		time_last_update=NOW() WHERE employeeID='$idemployee' ";
	mysql_query($update);
}else if (isset($_REQUEST['createSalary'])){
	$createsalary = "UPDATE sa_regulation_salary  SET basic_salary ='$basicsalary',allowance_basic_salary='$allowancebasicsalary',allowance_c='$allowanceC',
		allowance_senior ='$allowance_senior',salary_insurance='$insuranceSalary',createDate =NOW(),user_create='$user_create' WHERE employeeID='$idemployee' ";
	mysql_query($createsalary);
}
mysql_close($connection);

if (isset($_REQUEST['update'])){
	$_SESSION['alertupdate'] = "";
	header("Location: ../salary.php?content=regulation_salary&page=$page");
}

if (isset($_REQUEST['createSalary'])){
	$_SESSION['alertinsert'] = "";
	header("Location: ../salary.php?content=regulation_salary&page=$page");
}
?>